home *** CD-ROM | disk | FTP | other *** search
/ The Fatted Calf / The Fatted Calf.iso / Applications / Graphics / NXPlot3d / Source / Plot3DView.h < prev    next >
Text File  |  1994-02-20  |  4KB  |  179 lines

  1. /* Plot3dView.h   Copyright 1992 Steve Ludtke */
  2. #import <3Dkit/N3DCamera.h>
  3.  
  4. #define SS .01        /* symbol size. 1.0 would cause the symbols to be */
  5.             /* as large as the view */
  6. #define MAXSETS 5    /* maximum number of sets, changing this number */
  7.             /* requires IB changes as well */
  8. #define NFN 5        /* currently this is redundant. Number of active */
  9.             /* data sets */
  10. #define TIMESTEP .1    /* Time in sec between updates */
  11.  
  12. #define MAXGRID 120    /* maximum x and y grid components */
  13.  
  14. /* 3d point structure */
  15. typedef struct {
  16.     float x,y,z;
  17. } Point;
  18.  
  19. #define MM_none 0
  20. #define MM_height 1
  21. #define MM_grad    2
  22. #define MM_nextset 3
  23.  
  24. #define OVER_surf    1
  25. #define OVER_base    2
  26. #define OVER_csurf    4
  27.  
  28. #define RF_axis        1
  29. #define RF_backs    2
  30. #define RF_floor    4
  31. #define RF_ticks    8
  32. #define RF_planes    16
  33. #define RF_labels    32
  34. #define RF_persp    64
  35.  
  36. /* data set preferences structure (incudes pointer to actual data) */
  37. typedef struct {
  38.     char sym;        /* -1 means don't plot, else 0<=sym<=7 */
  39.     Point *fileData;    /* data from a file, NULL if equation mode */
  40.     Point *data;        /* data to be displayed. In file mode it */
  41.                         /* contains the visible subset of the data */
  42.     Point *Sdata;        /* Spherical data to be displayed (mode 7) */
  43.     RtColor *color;
  44.     int nfdata;        /* # points in file data */
  45.     int ndata;        /* # points in data */
  46.     int nx,ny;        /* grid points in x and y */
  47.     id expr;        /* points to the Expression (formula eval.) */
  48.     RtColor mapcol[5];
  49.     unsigned char mapsel[5];
  50.     short mapmode;
  51. } SetPref;
  52.  
  53. /* timer for spinning, etc ... */
  54. DPSTimedEntry timer;
  55. void itstime(DPSTimedEntry entry,double now,id call);
  56.  
  57. @interface Plot3DView:N3DCamera
  58. {
  59. id mode;        /* mouse mode selector */
  60. id controller;        /* points to PControl */
  61. id shape;            /* shape containing 3d plot */
  62. id ambLight;
  63. id aLight;
  64. id varT;        /* variable text matrix */
  65. id flagSel;
  66. id autotick;    /* flag for automatic tick spacing generation */
  67. id tickpos;        /* matrix of tick values */
  68. id axisTitle;    /* matrix of axis titles */ 
  69. id aspectS;
  70. id fontSize;    /* font size selector */
  71. float chi,theta,dchi;    /* viewing angles/speeds */
  72. float lchi,ltheta;        /* light angle */
  73. float ambient;            /* ambient light level */
  74. float minX,maxX;    /* current min/max values */
  75. float minY,maxY;
  76. float minZ,maxZ;
  77. float aspect;        /* x,y/z aspect */
  78. RtColor flagcol[5];
  79. RtPoint Tick0,Tick1,Tick00,Tick01;        /* tick min/max for x-fer to shape */
  80. int Rmode,Rflags,Omode;
  81. char pscom[1000];    /* postscript buffer for DPSUserPath */
  82. float pspath[3000];    /* increases drawing speed substantially */
  83. float psbbox[4];
  84. int psc;        /* counter for user path */
  85. char initflag;        /* flag so timer knows the first time it's called */
  86. SetPref pref[MAXSETS];    /* preferences for data sets */
  87. }
  88.  
  89.  
  90. -initFrame:(NXRect *)myrect;
  91. -free;
  92.  
  93. /* rescales coord. system after size chaged */
  94. -superviewSizeChanged:(const NXSize *)oldsize;
  95.  
  96. /* draw 3d plot */
  97. -drawPS:(NXRect *)myrect :(int)rectCount;
  98.  
  99. /* change viewing angle */
  100. -setAng:(float)theta :(float)chi;
  101.  
  102. /* used to do mouse zooming and spinning */
  103. -mouseDown:(NXEvent *)event;
  104.  
  105. /* points to controller object, usually set with IB instead */
  106. -setcontroller:del;
  107.  
  108. /* called by timer to do one time step */
  109. -step;
  110.  
  111. -(int)acceptsFirstMouse;
  112.  
  113. /* recalculate and display plot (and density plot, via controller) */
  114. -zoom:sender;
  115.  
  116. /* change min/max values */
  117. -zoomTo:(float)minx :(float)miny :(float)maxx :(float)maxy;
  118.  
  119. /* toggles dchi=0 on and off */
  120. -togFreeze:sender;
  121.  
  122. /* Makes a surface map for a rib file*/
  123. -makeSMap:sender;
  124.  
  125. /* dump .rib file from 3d view */
  126. - dumpRib:sender;
  127.  
  128. /* currently does nothing */
  129. - renderSelf:(RtToken)context;
  130.  
  131. /* sets intensity of ambient light */
  132. - setAmbLight:sender;
  133.  
  134. /* sets intensity of distant light */
  135. - setLight:sender;
  136.  
  137. /* sets chi of distant light */
  138. - setLightX:sender;
  139.  
  140. /* sets theta of distant light */
  141. - setLightY:sender;
  142.  
  143. /* sets rendering mode */
  144. - setMode:sender;
  145.  
  146. /* prints window with white background */
  147. - printPSCode:sender;
  148.  
  149. /* set drawing flags */
  150. -setFlags:sender;
  151.  
  152. /* set overlay flags */
  153. -setOverlay:sender;
  154.  
  155. -setFlagColor:sender;
  156.  
  157. -size320:sender;
  158.  
  159. -setEye:sender;
  160.  
  161. -setAsp:sender;
  162.  
  163. /* set perspective or orthographic projection */
  164. -setProj:sender;
  165.  
  166. -tickCalc:(float)n :(float)x0 :(float)x1 :(float *)min :(float *)spa;
  167.  
  168. -(float)getTheta;
  169.  
  170. -(float)getChi;
  171.  
  172. -PRTiff:sender;
  173.  
  174. - renderTIFF:(char *)fsp;
  175.  
  176. /* reset aspect to 1:1 */
  177. - aspect11:sender;
  178. @end
  179.